package com.evan.common.core.constant;

public enum SceneEnum {

    SCENE_SAFETY(1, "场所安全"),
    INFORMATION_SYSTEM(2, "信息系统"),
    DOCUMENT_ARCHIVE(3, "单证及档案管理"),
    GOODS_ITEM_SAFETY(4, "货物、物品安全"),
    TRANSPORTATION_SAFETY(5, "运输工具安全"),
    CONTAINER_SAFETY(6, "集装箱安全");

    private int code;
    private String name;

    SceneEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static SceneEnum getByCode(int code) {
        for (SceneEnum sceneEnum : values()) {
            if (sceneEnum.getCode() == code) {
                return sceneEnum;
            }
        }
       return null;
    }

    public static SceneEnum getByName(String name) {
        for (SceneEnum sceneEnum : values()) {
            if (sceneEnum.getName().equals(name)) {
                return sceneEnum;
            }
        }
        return null;
    }
}
